package org.xxpay.pay.channel.huypay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * pangxiaoyu
 * 2020年3月25日14:09:45
 */
@Component
public class HuypayConfig {

    public static final String CHANNEL_NAME = "huypay";
    protected final static String CHANNEL_NAME_ALIPAY_QR = CHANNEL_NAME + "_qr";   // 聚合支付

    public static final String CHANNEL_PAY_TYPE = "101";    // 聚合支付方式
    public static final Long PAY_ORDER_TIME_OUT = 3 * 60l;              // 订单超时时间，单位秒

    public static final String RETURN_VALUE_SUCCESS = "SUCCESS";    //回调返回状态
    public static final String RETURN_VALUE_ERROR = "ERROR";

    // 应用账号
    private String appKey;
    // 商户号
    private String merId;
    // 秘钥
    private String appSecret;
    // 商户号
    private String shopId;
    // 请求地址
    private String reqUrl;

    public HuypayConfig(){}

    public HuypayConfig(String payParam) {
        Assert.notNull(payParam, "init " + CHANNEL_NAME +" config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.appKey = object.getString("appKey");
        this.merId = object.getString("merId");
        this.appSecret = object.getString("appSecret");
        this.shopId = object.getString("shopId");
        this.reqUrl = object.getString("reqUrl");
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getMerId() {
        return merId;
    }

    public void setMerId(String merId) {
        this.merId = merId;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }
}
